package com.treasure.mall.biz.entity.auction;

import com.treasure.mall.biz.entity.BasePO;
import com.treasure.mall.biz.entity.user.UserPO;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 拍卖出价有效记录
 *
 * @author allan
 * @version 1.0.0
 * @date 2020/7/16
 */
@Entity
@Table(name = "zb_auction_bid")
@Setter
@Getter
@Cacheable(false)
public class AuctionBidPO extends BasePO {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;
    /**
     * 出价人
     */
    @ManyToOne
    @JoinColumn(name = "rel_user_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private UserPO userPO;
    /**
     * 拍卖id
     */
    @ManyToOne
    @JoinColumn(name = "rel_session_id", foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
    private AuctionSessionPO sessionPO;
    /**
     * 出价金额
     */
    @Column(name = "bid_amount")
    private BigDecimal bidAmount;
    /**
     * 缴纳的保证金
     */
    @Column(name = "security_deposit", scale = 2, precision = 9)
    private BigDecimal securityDeposit = BigDecimal.ZERO;
    @Column(name = "is_success")
    private boolean success;
    @Column(name = "deal_order_id")
    private String dealOrderId;
    /**
     * 支付超时时间
     */
    @Column(name = "pay_expire_time")
    private LocalDateTime payExpireTime;
}
